import * as dd from 'dingtalk-jsapi';
import {isPhone} from './devictUtil';

const DingTalkLinkUrl = 'https://applink.dingtalk.com/page/link'
/**
 * 是否钉钉环境
 * true: 是钉钉环境
 * false: 非钉钉环境
 */
export const isDingTalk = () => {
  return dd.env.platform != 'notInDingTalk'
}


/**
 * 钉钉打开普通页面
 */
export const openDingTalkLink = (url: string) => {
  return DingTalkLinkUrl+`?target=${isPhone()?'fullScreen':'workbench'}&url=${encodeURIComponent(url)}`
}
